﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

using Dxr.Police.Models;

using Zongsoft.Common;
using Zongsoft.Security.Membership;

namespace Dxr.Police.IACS.Web.Http.Controllers
{
    [Authorization(AuthorizationMode.Anonymous)]
    public class CommonController : ApiController
    {
        [HttpGet]
        public HttpResult Enum(string type)
        {
            var result = new HttpResult()
            {
                ret = HttpResult.Success,
            };

            type = type.ToLower();

            switch (type)
            {
                case "datatype":
                    result.content = EnumUtility.GetEnumEntries(typeof(IACS.Models.DataType), true).Where(p => (int)p.Value < 100).ToList();
                    break;
                default:
                    result.ret = HttpResult.Error;
                    result.msg = "该类型不存在";
                    break;
            }

            return result;
        }
    }
}
